Skip to main content

Full text of "Fault Tolerance Safety In Numbers OCR"

See other formats


CIRCUIT CELLAR 



THE MAGAZINE FOR COMPUTER APPLICATIONS 



considering: 
the details 1 



BobPonlN 



I/O For Embedded 
Controllers 

Parti: Digital I/O 



V esigning genenc 
embedded control- 
lers is as much of an 
art as it is a science. 
Evay company I've worked for has 
attempted to spin a controller board that 
could be reused m future projects. 
These companies range frcan a scien- 
tific research instnimentation company 
to a company that built wafer-handling 
tools for VLSI fab. These efforts have 
met with varying degrees of success. 

Currently, I work for a company that 
makes C-progi ammable embedded 
controllers. Designing commercially 
successful generic controllers is an 
interesting problem. You have to try to 
predict your customer's applications 
and deduce their I/O requirements — ^no 
meager task. 

If you work for a company that 
wants to develop an embedded control- 
ler as a base for cuirent and future 
products, you're lucky. This type of 
project is just plain fun. 

Being intimately familiar with your 
company's product line will help you 
predict what t} pe of applications the 
controller will be applied to. Knowing 
this, you should be able to make some 



educated guesses about the I/O mix 
you'll need. 

The I/O circuits presented here have 
shown themselves to be useful in a wide 
variety of applications. The next time 
vou ha\'e to design I/O for your firm's 
embedded controller project, perhaps 
ms, or more of the circuits or ideas 
presented here will be of use 

In Part 1 I focus on digital tech- 
niques, and the next installment will 
address analog signal conditioning, 
A/D conversion, and D/A conversion. 

DIGITAL INPUTS 

One of the simplest forms of I/O is a 
digital in|nit. There are several common 
implementations and each has a unique 
set df tradeoffs. 

The simplest fonn of digital input is 
shown in Figure la. The 74HC244 
buffer sits between the processor and 
the outside world. When the processor 
wants to read the status of devices on 
ttie input port, the 74HC244's ou^ut 
enable is asserted, and data flows 
through the buffer and onto the data 
buiS. 

If the system must have many digital 
inputs, the 74HC244 scheme may add 
an unacceptable level of capacitance to 
the microprocessor's data bus. The 
tristated output of the 74HC244 has a 
worst-case capacitance of 20 pF (" see the 
74HC244 datasheet) . It doesn't take 
many 74HC244s on a bus to slow it 
down. 

One altemative to the 74HC244 
scheme is to use a multiplexer such as 

the 74HC257 shown in Figure lb. The 
74HC257 has a maximum output ca- 
pacitance of 15 pF fsee the 74HC257 
dat ashco Q. This capacitance is slightly 
less than the 74HC244, and when you 
consider that this scheme gives two 
inputs per data bus line, the equi\ alent 
loading is 7.5 pF per input (compared 
to 20 pF for the 74HC244). 

The 74HC151 is an 8-to-l mux, but 
it doesn't have the ability to Instate its 



I/O, I/O, so off to 
work.... Designing 
generic controllers 
with only guesstima- 
tions of what the end- 
product I/O needs 
might be keeps Bob 
busy at work. When it 
comes to designing 
I/O, save yourself 
some work and take a 
look at the circuits 
that he covers in the 
first half of this series,. 



mmmmk* mum 



74HC267 



8 digital \ 
inputs / 



AO 
A1 
A2 
A3 
BO 
B1 
82 
B3 



YAO 
YA1 
YA2 
YA3 
YBO 
YB1 
YB2 
YB3 



PEA PES 



DO 


D1 


\ 


D2 


S 


D3 


^ 


D4 


N 


D5 


S 


D6 


\ 


D7 


\ 


S 



b) 



8 digital 
inputs 



^ bus 



AO 






A1 
A2 


YO 


DO 


Y1 
Y2 
Y3 


D1 


A3 


D2 


BO 


D3 


81 




82 






83 






SELECT 


OE 





READ{U y Te Gtae 
^ logic 



Figure la— >\f $0. 19. the 74HC244 buffer can aM 
eight digital inputs to a system wMi UUe extra cost 
b—Multipl&(ms(^ ^reduce (^aciSveioa^r^ 
on^ckia tm. 



8 digital 
inputs 



V / Data 



READ(l) 



-<A0 
yQlue 



SELECT OE 

AO 

A1 

A2 
A3 
BQ 
B1 
B2 
B3 



YO 

Y1 
Y2 
Y3 



/Data 
bus 



74HC257 



outputs. Ho\\c\ cr, these could be used 
in conjunction with 74HC244s to pro- 
vide digital inputs with only one-eighth 
the capacitive loading per digital input 
that would be incurred with only 74HC- 
244s. 

The 74HC244 or 74HC257 schemes 
work if you don't need to simulta- 
neously sample more digital inputs than 
the data bus can carr>' at one time. If 
you do need to simultaneously sample a 
larger number inputs, you'll need to 
latch the data with any number of 
latches (see Figure Ic). Some of the 
more popular choices are the 74HC374 
and 74HC574. 

The two parts are function- 
ally equivalent, but the 74HC- 
574 physically has all of tiie 
inputs on one side of the IC and 
all of the outputs on the other 
side. This arrangement can 
make PCB routing simpler. 
However, at 1 5 pF, the output 
capacitance of the 74HC574 is 
almost as hi^ as on the 74HC- 
244. 

Once again, multiplexers 
could be used to reduce capaci- 
tive loading per input ratio. If 
muxes are used, the tradeoff is 
that } ou limit the number and 
combination of inputs that can 
be sampled simultaneously. 

There is a more elegant solu- 
tion. Figure Id shows how 
74HC59'Z shift registers can be . 
cascaded to ]MO\ ide a large 
number of digital mputs with a 



minimum attMHtiOf ^pacitive bus 
loading. 

The 74HC597 has eight flip-flops 
connected to the inputs. These form an 
edge-triggered input latch. The 74HC- 
597 also has eight additicmal edge- 
triggered flift^lopt tbat ccnnprise a dbift 
register 

In Figure Id, data is simultaneously 

sampled on all inputs when the glue 
logic causes a rising edge on the RCLK 
signal. 

Next, the processor, through the glue 
logic, commands the data to be moved 
from the input latches into the shift 
register. This is done by asserting 



SLOAD(L). 

With the data in the shift register, 
the processor has only to clock the data 
through one bit at a time using SCLK. 
The data is read by assating READ(H) 
and looking at DO. 

A simple van ant of this circuit in- 
volves bringing the QH signals through 
multiple buffers, say a 74HC244, onto 
separate data bus lines. This process 
reduces the amount of time required to 
retrie\'c the serial data because data can 
now^ be read one w ord at a time. 

Now that we have a few methods for 
interfacing the microprocessor's data 
bus to the outside world, it's time to 
consider the practical aspects of protect- 
ing the system from the abuse that 
com^ with ccamecticns to the outside 
world. 

PROTECTtNG THE DIGITAL INPUTS 

It's generally considered bad design 
practice to leave unconnected CMOS 
inputs floating. Unconnected inputs 
have a tendency to bang between input 
thresholds (V^^^ and V^j). The result is 
that the internal transistors spend a lot 
of time switdiing unnecessarily. Not 
only does this contribute to noise m the 
systan, but it consumes real power. 

Installing a high-value pull-up or 
pull-down resistor ensures that any 
unconnected inputs are pulled to a 
known level. CMOS inputs usually 



74HC574 



C) 



8 digital 1 
inputs 



DO 
01 
D2 
D3 

D4 
D5 
D6 
D7 



A 



nputs 



(30 
Q1 

Q2 
Q3 
Q4 

Q5 
Q6 
Q7 
OE 



D1 




D2 




03 


s 


04 




DS 


s 


D6 


S 


07 


-A 





ReadLateh-KD 



g Data 
?• — ^bus 

G4uB 
Logic 



<») 



Digital 

inputs 



Samplelnputs(H) -Glue 
Logic 



SLoad -y- 
SCLR 3- 

RCLK <- 
SCLK < - 
Ser 



ReadUtcli2(U 



^Glue 
Logic 



OE 
QO 
Q1 
Q2 
Q3 
Q4 
Q5 
06 
Q7 



DO 


/ 


D1 


/ 


02 


/ 


03 


/ 


D4 


/ 


D5 


/ 


D6 


/ 


D7 


/ 



•Data 
' bus 



Digital 
inputs 



->D0 



Read(H) ^ Glue 
^ Logic 



A 


QH 


B 




C 


SLoad 





SCLR 


E 
F 


RCLK < 


G 


SCLK < 


H 


Ser 



-< Glue Logic 
-< Reset(L) 

— < Glue Logic 
— < Glue Logic 



74HC574 



From Other 74HC597S 



Figure 1e— Us/ngd/screfe /atohes ;s a good way to simultaneously cs^re many inputs. 4— The 75HC597 is around $1X2$ 
and can be cascaded indefinitely to provide digital inputs. 



2 S0i»mi»m urn 



WMirtit.oiH UM ito( ri liu rj iio ii il bi i^ 



have maximum input cuirents of 
1 nA, with t5rpical values much 
smaller. So, you can use resistors 
approaching 1 megaohm as 
pullups or puUdowns. I generally 
use 100 kilohms to further reduce 
the EMI susceptibihty of the in- 
put. 

In man\' embedded applica- 
tions, the inputs are occasionally 
stressed significantly above 5 V ot 
even below ground. A simple 
series resistor can protect digital 
inputs from such overvoltages. 
Figure 2a shows such an arrange- 
ment. The intemal diodes will 
clamp the voltage at the input of 
the CMOS device. These diodes 
are part of the ESD protection 
scheme designed into high-speed 
CMOS (imCxxx) devices. 

As long as the current into the 
input is sufficiently limited, no 
damage occurs to the device. The 
input-protection diodes are falni- 
cated to mitigate or eliminate ESD 
damage to CMOS devices during 
the board-level manufacturing 
process. However, these diodes 
can also be used as clamps foe 
ovCTVoltage protection. 

A more conser\'ati\ e and more 
expensive design, shown in Figure 2b, 
adds external discrete Schottky diodes. 
The forward \'oltage di'op on these 
devices is about one-third of the silicon 
diodes in the IC's ESD protection cir- 
cuit. Therefore, the intemal diodes will 
never conduct. All the current will be 
canicJ b\ the forward-biased discai^e 
Schottky diodes. 

This type of external overvoltage 
protection uses precious PCB real es- 
tate, and besides component cost, 
there's also an insertion cost to populate 
these components. For small passi\ e 
components, the insertion cost will be 
dominant and can't be ignored. Hew- 
lett-Packard makes a dual Schotflcy 
diode in a SOT-23. 

In Figure 2b, the external Schottkv' 
diodes prevent any possibility of CMOS 
latch-up on the IC. There will also be 
an increased immunity to ESD. The 
level of robustness demanded by the 
application dictates whether all, some, 
or none of the inputs require this added 
protection. 



a) 



H igh-sf)e«d CMOS device 



Current-limiting 




ESD protection 
diodes 



Current-timiling 
re^stor 




High-speed CMOS device 



c) 



Digital 
input ° 



Low-pass filter 

V " 



r 



ESD protection 
diodes 



High-speed CMOS device 



100 i<a 
puit^kwwi < 



ESD protection 
diodes 



Figure 2a— A simple resistor coupled w/f/i fhe internal ESD protection 
diodes of a high-speed CMOS device makes a surprisingly robust 
digital input b—For the cautious. Schotih/ diodes eliminate any 
charxe of CMOS latch-up. o—A capacitor along with the current- 



Figure 2c shows a capacitor at the 
input of the CMOS gate. This setup 
sen es \\\o purposes. First, the RC cir- 
cuit forais a low-pass filter This acts to 
debounce the input. Glitches or contact 
botmces will be filtered out. Secondly, 
this low-pass filter also provides added 
immunity to ESD. 

If the capacitor were ideal, a 0. l-pF 
capacitor behind a 22-kilohm resistor 
would be adequate ESD protection for 
any application. Unfortunately, the 
finite ESR (effective series resistance) 
and ESL (efrecti\ e series inductance) of 
the physical device prevent the circuit 
from performing optimally. Figure 2d 
shows how ESR and ESL are modeled. 

Most capacitor manufactures char- 
acterize t> pical ESR and ESL behavior 
of their dc\ iccs, enabling \"ou to model 
the behavior of the circuit. But, model- 
ing is a bit of an art when it comes to 
predicting a physical circuit's behavior 
during an ESD event. For example, the 
input protection diodes in most CMOS 
devices are preceded by a polysilicon 



resistor of unspecified value. And 
one of the diodes is often a distrib- 
uted "diode resistor" f see the An- 
313 datasheet y These, in 
conjunction with difficult-to-pre- 
dict liSD discharge wavefonus, 
make modeling a dubious tool at 
best. 

Unfortunately, testing is the 
only way I know to get a feel for 
how well a circuit will stand up to 
ESD. Testing can be riskv, and lab 
techniques are somewhat subjec- 
tive. Even testing a couple dozen 
devices is an incredibly small 
sample set to extrapolate perfor- 
mance data from, but I kiK>w of no 
better way. 

Our engineering group uses a 
Schaffner NSG-435 ESD gun to 
simulate transient events. This 
$7000 piece of lab equipment ea- 
ables us to zap our circuits with up 
to ±16.5-kV events. We have had 
great success weeding out weak 
designs with this tool. Several 
companies rent this or similar ESD 
guns. 

If your application requires that 
little bit of extra insurance, you can 
always place a transient voltage 
suppressor (TVS) on the input. 
Many companies build TVS's, but Gen- 
eral Semiconductor's Transorbs are 
probably the best known and are sec- 
ond-sourced by .several manufacturers. 

Figure 2e shows the most heavily 
armored input that is practical. L 1 is a 
ferrite bead to reduce conducted RFI. 
LI, Rl, and the open-circuit ca]iaci- 
tance of the TVS help slow down any 
high- speed transient event until the 
TVS can turn on. Rl also sen-es to 
limit current into the TVS if the input 
is pulled to a low-impedance source 
that is of a higher potential than the 
TVS's standoff voltage. 

R2 and CI form a low-pass filter 
that will debounce switch contacts and 
fiirther attenuate transient events. The 
diodes Dl and D2 prevent the CMOS 
in]iut from going abo\ e V^^. or below 
ground by 0.2 V Dl and D2 will also 
provide additional ESD protection. 

The circuit shown in Figure 2e is 
gross overkill for most applications. 
However, for certain industrial or mis- 
sion-critical applications, this is the 



www»eireuitetU«':eointonlHM 



GfRCUITSELU^* OMUNE 



best protection you can have 
without resorting to optoiso- 
lation. hisertion costs, com- 
ponent cost, and boaid space 
are the factors to be weighed 
against ESD protection, 
overvoltage protection, and 
debouncing needs. 

A bit of caution should be 
tised when selecting resistors 
for use in circuits that may be 
subjected to ESD. It tiims out 
that plain old carbon-compo- 
sition axial-leaded resistors 
are the best [1]. Metal film 
axial resistors and surface- 
mount resistors have patterns 
cut into the film to trim the 
film geometry to achieve the 
desired resstance. ESD has a 
tendency to jump the insul- 
ative gaps etched into the 
metal film. 

This behavior has two 
ramifications. First, the resistor's valiie 
is effectively reduced during the event. 
Second, ionization paths may form, 
creating a permanently altered resis- 
tance value. 

Surface-mount resistors have similar 
problems, but they alK) have problems 
with hot spots forming in the metal film 
when subjected to ESD. These hot spots 
are caused by nonuniform current den- 
sities flowing in the metal film. The net 
result is that the resistor can be perma- 
nently damaged by ESD events. 

There are other enhancements that 
can be added to digital inputs. Analog 
comparators can be used if precisely 
controlled switching thresholds are 
required. Comparators can be designed 
with or without hysteresis. And, if a 
good-size voltage divider is placed on 



High-speed CMOS dewiee 




Capacitate 



High-speed CMOS device 




PtimatyESD 
protection 



/ 

coupled with R1, 

sustained overvoltage 
protection, also 
additional ESD protection 



Figure 2d— ESR anti £SL m wifyrtum^. psmsic impe^mt^ assocmted vMi 
physical devices. e~-Tlm eife^::^0^^mpeit^oa a:p&-:f^basls, M l^ ak; 
&(tmmely rugged. 



the input, thresholds way above V^^^, or 
way below ground can be managed. 

Optoisolators can also be used with 
digital inputs. These devices can be 
used to get several thousand volts of 
galvanic isolation. However, the input 
device must supply about lOOOx the 
input current to an optoisolator than is 
required by a CMOS gate. Optoiso- 
lators— at least inexpensive ones — can 
be quite slow. And, you still need to 
protect the LED in the opto-isolator 
from ESD damage. Depending on the 
application, optoisolators may be a 
benefit or a detriment. 

DIGITAL OUTPUTS 

For digital outputs, the bus loading 

tradeoffs are similar to those encoun- 
tered with digital inputs. There are four 



high-speed CMOS devices I 
want to discuss — ^the 74HC- 
574, the 74HC273, the 74- 
HC259, and the 74HC594. 

Figure 3a shows how 
digital outputs can be imple- 
mented with a 74HC574. 
This is the same part that 
was used to implement digi- 
tal inputs in Figure Ic. Be- 
sides a high eapacitive bus 
load per output (10 pF per 
output), the 74HC574 has no 
global reset for the latches, 
which means the system 
RESET signal can't be used 
to put the outputs into a 
known state. Having digital 
outputs that are nondeter- 
nainistic on powerup is ex- 
tremely troubling. 

The circuit shown in 
Figure 3a works around this 
problem by adding an addi- 
tional flip-flop and pull-dovm resistors 
on the outputs. On powerup, the 
74HC574's outputs are tristated and the 
outputs are pulled low with the 
100-kilohm resistors. Once the system 
is up and running, the processor can 
write data into the 74HC574 and enable 
the outputs by writing a 1 into the 
supplementaiy flip-flop. 

Urn 74HC273 has a CLR(L) signal 
but no output enable. This isn't a prob- 
lem if your application doesn't require 
tristated outputs. Figure 3b shows a 
74HC273 configured as an output latch. 
The input capacitance is 10 pF (maxi- 
mum) and may present a bus loading 
issue if many 74HC273s are needed. 

The 74HC259 is a bit-addressable 
latch. Figure 3c shows how to use the 
74HC259 to reduce the capacitance 



Digital 
outputs 



QO 


DO 


Q1 


D1 


Q2 


D2 


Q3 


D3 


Q4 


D4 


Q5 


D5 


Q6 


D6 


Q7 


D7 


OE 


A 



WRITE(H)^ GIue 
^logic 



Q CLR D 



-<Restt(L) 
-DO 



Glue 
~N logic 



b) 



Digital 
outputs 



QO 


DO 


/ 


Q1 


01 


/ 


Q2 


D2 


/ 


Q3 


D3 


/ 


Q4 


04 


/ 


Q6 


D5 


/ 


Q8 


D6 


/ 


Q7 


D7 




Clear 


CLK 







WRITE(H) Glue 



-<Besel(l) 



0) 



Digital 
outputs 



QO 




Q1 




Q2 




Q3 




Q4 


AG 


Q5 


A1 


C3 


A2 


Q7 


D« 


&ear 


EN 



AO/ 



30- 



-<D0 



Y WRITE(L) Glue 
^ logic 



Figure Za—Even at $0.20, the lacl< of a CLR signal mates the 74HC574 a questionable choice for an output latch b—The 74HC273 has a CLR(L) signal allowing determin^t 
powerup. e—The 74HC259 can reduce loading on the system data bus, but the micmprocessor's address bus must still drive a heavy eapacitive bad. 



4 S^^DftM^ 



■Gimm'miM* ■w&m 



d) 



Digital \ ' 
outputs 7 ' 



1 



QO 


QH 


Q1 




Q2 


RCLR 


Q3 


SCLR 


04 


SCLK< 


Q5 
Q6 


RCLK< 


Q7 


Ser' 



74HC594 



Digital 
outputs 5 



QO 


QH 


Q1 




Q2 


SCLR 


Q3 


RCLR 


Q4 




Q5 


SCLK< 


Q6 


RCLK< 


Q7 


Ser 



— <Glue Logic 
— <Giue Logic 



SerialDataln(H) 



<D0 



74HC244 



DO 


QO 


D1 


Q1 


D2 


02 


D3 


03 


m 


Q4 


D5 


Q5 


D6 


Q6 


D7 


Q7 


QEA 


DEB 



74HC574 





OE 


QO 


DO 


Q1 


D1 


Q2 


D2 


Q3 
Q4 


D3 


D4 


05 


D5 


Q6 


D6 


Q7 


07 


A 


OE 



ReadlnputLatcli(L) 
'-^ ^^^Glue logic 

> — 7— <Data bus 



iQCLR< 



— <^GIue logic 



■<Reseti;L) 



'i^Sto logie 



Figure Zd— The 

74HC594 is a flexible 
and inexpensive ($0.25) 
shift register, suitable for 
creating digital outputs, 
e — You can combine 
inputs and outputs to 
form a set of byte-wide 
ptogrmmable I/O 



load per output to 1.25 pF per output on 
the data bus. The 74HC259 has a re- 
quiremmt for three address lines, so the 
address bus will continue to be heavily 
loaded if many latches aipe placed m, the 
same address lines. 

One 74HC259 gotcha to look out for 
is the active-low level-triggered latch 
enable. When using the 74HC259 as an 
output latch, the address and data must 
remain valid until the rising edge (de- 
assertion) of the WRITE(L) signal (see 
Figure 3c). All the other latches dis- 
cussed have rising-edge-triggered 
clocks. The 74HC259 has a level-trig- 
gered latch enable to allow the device to 
be used as a 3-8 decoder in other appli- 
cations. 

Figui"e 3d shows how to use the 
74HC594 shift register, which is a use- 
ful part. The device has a shift regista- 
coupled to independently controlled 
output latches. The data is clocked 
through the shift register chain and 
then all outputs are simultaneously 
updated. The 74HC594 has a clear for 
both the output latch and the shift r«gis' 
ter chain. 

The 74HC594 does not have the 
ability to tristate its outputs. The 74- 
HC595 trades the 74HC594's output 
latch clear pm for an output IrLstate pin. 
Other than that single pin, the 74HC- 
594 and 74HC595 have identical 
pinouts. 

In Figure 3d, data from DO is 
clocked into the shift register chain 



using SCLK. Once the shift-register 
chain is fully loaded, all of the outputs 
are updated simultaneously when the 
processor causes a rising edge on 

RCLK. 

If the shift register chain is long, it 
can be split up into smalla- chains, eadi 
fed with a separatevi^i liiS bit (DO,, 
D1,D2, ...). 

The 74HC574 has the ability to 
tristate the outputs, which can be useful 
if you need to create an I/O point that is 
both an input and an output. One thing 
to watch out for in this type of circuit is 
powerup initialization. If an I/O may be 
used as an input, it should default to an 
input, lest the output latch contend with 
an offboard digital output device. Fig- 
ure 3e shows how to construct a set of 
I/O points. 

BRIDGING THE GAP 

Now that we have some ideas on 
how to implement the logic associated 

with a digital output, lefs consider how 
to bridge the gap between CMOS out- 
puts and the real world. Most practical 
applications require more cun'ent drive 
capability than a CMOS digital output 
can deliver 

Perhaps the most obvious method is 
the use of a relay. Most relays require 
more current than a CMOS output can 
source (or sink). An intermediate NPN 
BJT is a common solution. Figure 4 
shows ho\'\' to dn\ c a relav. A 1N914 is 
a time-honored diode for flyback sup- 



pression. 

Relays are usually considered bulky, 
but at least one company has inexpen- 
sive surface-motint devices. The Aro- 

mat TQ-SMD series parts are fantastic. 
They are available in many pole and 
ttirow combiiiations as well as in a 
variety of coil voltages. Latdung de- 
vices are also available. 

Some of fee advantages mechanical 
relays have over other alternatives in- 
clude, low contact resistance, ability to 
drive AC or DC loads, excellent electri- 
cal isolation, and high impedance when 
contacts are open. For many applica- 
tions, mechanical relays are sdll the 
best fit. 

Also, solid-state relays can be pur- 
chased in many forms. Solid-state re- 
lays generally carry a hefty price tag, 
may be fairly limited in the type of load 
they can drive, and may require heat 
sinking. However, when properly used, 
solid-state relays have a much longer 



+v 




High 
Gurtef^ 
cohlacts 



Figure A— Relays are expensive and mechanically 
bulky, but for versaVte higthcumd outpufSt reSays m 
tough to beat 



S«f!(*iv6«r 1899 f 




life than their mechanical 
cousins. 

The aiTay of devices 
that can be used to bridge . 
the gap is simply too vast 
to cover in one article. 
Fortunately, if you can just 
make the stq> from the 
CMOS output to an output 
that can drive between 100 
and lOOO mA, the next 
step — driving lots of 
amps — is often a just mat- 
ter of selecting an appro- 
priate contactor (relay). 

Making that first step 
between CMOS and mod- 
erate current drive outputs 
can be accomplished with 
several devices, each with 
their onm strengths and 
weaknesses. 

For many years, sourc- 
ing and sinking drivers 
have been available in IC 
form. These are found in 
many applications, from 
driving LED arrays to sanall motors, 
and they are availabtefrOTtt mwy 
manufacturers. 

Motorola and Allegro sell the 
ULN2803, and Allegro also sells the 
UDN2985. The ULN2803 is a sinkmg 
driver, and the UDN2985 is a sourcing 
driver Both of these devices use a 
Darlington pair as the output switch. 
And both devices have integral flyback 
suppression diodes on each output. 
Figure 5 shows the pinout and output 
stage for each of the two parts. 

These devices have a nearly identical 
pinout and circuit boards can be de- 
signed to accept the parts interchange- 
ably. To accomplish this, the PCB will 
also reqaire a couple of jumpers to 
allow the two noninterchangeable pins 
(GND and K) to be jumpered to the 
appropriate place. 

The UI.N2803 can smk 500 mA per 
pin but is limited by the total power- 
dissipation capability of the package. 
This really means the entire package 
can sink around 500 mA split up across 
all the drivers. The maximum voltage 
allowed on the outputs is a respectable 
50 V 

The UDN2985 can siairce around 
250 mA. The maximum voltage drop 





ULN2«8a 



Output stage 
forULN2803 



UBN2985 



->H>K 



-oC^jSiJ 



3k£i 

Lvw-M/W- 
m 




-o Output 



on the output is 30 V. And again, the 
maximum drive capacity is limited 
more by the package power-dissipation 
characteristics than by the Darlington 
transistor outputs. 

When using these types of devices, 
one potential problem is the rektivety 
poor ability of the Darlington pair to 
pull the "on voltage" near the rail. 
Because the output transistor in a 
Darlington is never driven hard into 
saturation, the output is only pulled 
within 1.2-2.5 V of the rail, depending 
on This can be a problem in seme 
applications. 

Let's say you want to use a ULN- 
2803 to drive a relay with a 5-V coil 
and you only have a 5-V supply. The 
Darlington will only allow about 3.5 V 
to be developed across the relay. Many 
5-V relays have a maximum pick-up 
voltage (the voltage at which the relay 
is guaranteed to operate) higher than 
3.5 V 

For example, the Aromat TQ-SMD 
relays ha\'e a maximum pick-up voltage 
of 3.75 V for the 5-V relay. To ensure 
reliable operation with a ULN2803, you 
have to go to the 4. 5-V TQ-SMD, 
which has a maximum pick-up voltage 
of 3.38 V. The 4. 5-V parts have signifi- 



cantly longer lead times. 
Alternately, you could de- 
sign in a second higher 
voltage power supply, say 8 
V, to drive the relays, but 
this may add cost to the 
system. 

The second common 
problem that people mn 
into with Darlington output 
driva-s occurs when they 
try to use them to drive a 
CMOS input. The high- 
voltage drop across the 
Darlingtons give away the 
entire CMOS noise margin 
and then some. 

People usually ran into 
this kind of situation when 
they buy a PLC or turnkey 
controller that uses Dar- 
lington pairs to implement 
"high-cuiTcnt digital out- 
puts." When the customer 
tries to use these "digital 
outputs" to drive another 
device's CMOS input, it 
doesn't work. 

The real moral of the ston' here is, if 
you buy a controller, read the specifica- 
tions carefully. Darlington outputs are 
widely used in industry and although 
they are versatile, they do have limita- 
tions. Ultimately, the reliability of yonr 
system rests on your shoulders, not 
those of your suppliers. Always dig into 
the specifications and schematics of off- 
the-shelf controllers. Many companies 
provide complete schematics and speci- 
fications in their manuals. 

If you can't live with the voltage 
drop in a Darlington, you can always 
just go with a BJT or MOSFET imple- 
mentation of a high-current driver 
Each of these has tradeoffs. First, let's 
consider the BJT. 

Figure 6a shows a typical NPN sink- 
ing driver circuit. The circuit is simple, 
but there are still a fe^v details to keep 
m mind before laying this topology 
down in copper. 

Advantages of this circuit include 
low cost, high Vj,^, widely available 
parts, and simplicity of design. When 
the transistor is fully saturated, y^^^^^.^ 
can be on the order of 100-300 mV, 
allowing reasonablx high 1^, even with 
physically small devices. 



The trick to making all 
of this work is base current 
Ig. The current transfer ratio 
(beta or h^g) in saturation is 
very low, on the order of 
10-50. For inexpensive 
devices (hke the MPSA- 
2222Aor2N3904)over 
temperature 10 is a safe 
value to use for design. 
There are transistors that 
are optimizetl for switch- 
ing — ^for example, the Zetex 
FMMT625 SuperSOT tran- 
sistors. I use ;i \ alue of 20 

KeisAT) when designing 
with fliese parts. 

If you want to drive loads 
on the order of 500 mA 
witii a run-of-the-mill NPN, 
you'll need to .supply 50 mA 
of base current, or about 25 mA of base 
current if you use a more e?q)raisrve (by 
a factor of 10) device. 

Another design consideration is the 
total amount of current the digital latch 
that is used to drive the NPNs can 
source. A 74HC574 has an absolute 
maximum 1^^ of 70 mA (Fairchild 
Semiconductor). The 74HC574A from 
Motorola has a maximum 1^,^, of 75 mA. 
This is the maximum current that can 
be pulled through the V^^ pin or sunk 
into the GND pin. 

So, if you ha\-e a 74HC574 iiving 
eight NPNs, the base current to each 
NPN must be hmited to 70/8 = 
8.75 mA. And that numbo: leaves no 
safety margin. 

The 74HC574 falls into the class of 
parts considered by manufactures to 
need a little beefier-than-average cur- 
rent-handhng capacity . The 74HC259, 
for example, is more typical of the 
high-speed CMOS devices and has a 
maximum I^,^, of 50 mA. This translates 
to 50/8 = 6.25 mA of bai^ current. 

With a beta 
L limits I 

B I 

you can supply enough base current to 
keep the transistor turned on hard, NPN 

high-cuiTcnt dri^■ers don't work all that 
well, which is why devices like the 
ULN2803 use a Darlington. 

Figure 6b shows how to build a PNP 
high-side switch. Base cunenl in the 
PNP is the biggest concern. PNP high- 
side switches generate a lot of heat in 





Figure 6a— Ws is a typical implemen- 
tation of eight NPN sinking drivers built 

from a 74HC574. The 74HC574 can 
be overtaxed if all the BJTs are turned 
on b—When building high-side drivers 
like this, watch out tor high power 
disapaSoninttiePNP'sbaseiesislar. 



to an anemic 60 mA. Unless 



their base circuits when high voltages 
are being switched. 

If the NPN can sink 60 mA, then we 
should be able to have PNP Ij,'s of 
600 mA. That's pretty good. The 
trouble is, the power dissipated in the 
PNP's base resistor when the +RAIL 
voltage is high. The only way to handle 
this is to use a physically large resistor. 

The voltage drop across flie resistor 
is +RAIL - Vg^,^^p. - V^^^,^^,^y For 
example, if the -HRAIL voltage is 30 V, 
then the potential aox>ss the base reas- 
tor will be about 29 V (i.e., 30 -0.7 - 
0.3). 

If the ctffirent through the resistor is 

designed to be 60 mA, the po^^•er dissi- 
pated in the resistor will be 1 .74 W. So, 
a 2-W resister will be required. If you 
have eight of these circuits m your box, 
you have (8 x ] .74 =) 14 W of power 
being burned off as heat. 

This condition places additional 
burdens on the overall system design. If 
you have to remove 1 4 W of power 
from your product, you may need addi- 
tional ventilation or perhaps a fan. 

Another issue to be awai'e of is the 
leakage current (especially at high 
temperatures) in the NPN in the base 
circuit. The pull-up resistor should be 
selected to be as small as possible to 
overcome the leakage curroit and keep 
the PNP off 

Enhanccmenl-modc MOSFHTs are a 
natural choice for overcoming the base 
drive problems associated with the BJT 



circuits shown in Figure 6. 

Figure 7a shows a 
simple low-side drive. 
International Rectifier 
and Siliconix both have 
nice .selections of MOS- 
FETs. Recently, I've been 
tinkering with the IRFL- 
014 and 1RLL014N from 
International Rectifier 
These parts are in a 
SOT-223 surface-mount 
package and cost be- 
tween $0.30 and $0.50. 

Driving these dc\'ices 
is much like driving a 
capacitor. Once the gate 
is charged, the leakage 
current from the gate to 
the channel is negligible 
in this application. The 
biggest difficulty is getting the MOSFET 
to tum on hard with onlv a 5-V V,,,. 

The less expensive IRFL014 with a 
5-V gate drive will easily handle chan- 
nel currents of 500 mA. The IRLL014N 
is designed to be turned on with a 5-V 
Vjjj, although the maximum allowable 
V„3is±15V 

The primary disadvantage of MOS- 
FETs over BJTs is cost. The 2N2222s 
are just a few pennies. SuperSOTs (like 
the FMMT625) are just 25 to 30 cents. 
MOSFETs start at 30 cents and go up 
rapidly. 

Figure 7b shows how to use a P- 
channel MOSFET to build a high ade 
switch. When -MIAIL is at a relatively 
low voltage, we have the problem of not 
being able to fully tum on the 
MOSFET. This happens because we 
can't develop a high W^^. At high volt- 
ages on 4-RAlL, we need to limit V^j^ to 
avoid exceeding the maximimi allow- 
ableV^. 

International Rectifier's IRFL9014 is 
a P-chaimel MOSFET suitable for 
building low-cost, high-current drivers. 
At -f-RAIL voUages of 7-10 V, the 
MOSFET is turned on. The part really 
shines at V^ 's of 1 5 V The minimum 

us 

R„c f™" this device is 0,50 ohms, but 
the device only costs around $0.40. 

The maximum permitted on the 
1RFL9014 is 20 V The zener show n in 
Figure 7b must be .selected to limit V^,^ 
from exceeding this maximum. 

Sourcing drivers built like those 



www.eireuiteelbr.PQintonliM 



CIRCUIT CEUM • ONUNE 



Septomtwr 1399 7 




showl in Figure 7b can source higher 
currents when +RAIL is at higher volt- 
ages because we can develop a near 
maximum V^, on the MOSFET, thus 

turning il t)n fully. 

One advantage FETs have over BJTs 
is the abiUty to current share. BJTs 
don't cunent share well. You may par- 
allel FET -based channels to your 
heart's content. ITiis can be a big ad- 
vantage in some applications. 

If you design H-bridges for driving 
niotas, thermoelectric devices, or o&er 
high-current devices, the above prin- 
ciples directly apply. Other refinements 
that should be considered for high- 
current drivers include flyback suppres- 
sion for inductive loads, and ESD 
protection. 

There are other devices available to 
bridge the gap between CMOS devices 
and the outside world. Triacs can be 
used if you need to switch AC loads. 

WAIT ONE, OVER 

If you're designing an embedded 
controller for a specific application, 
selecting an I/O methodology is fairly 
straightforward. If you're designing a 
controller as a g^eric platform that's 
intended to meet an arrav of fiiture 
needs, selectmg an I/O mix is a bit 
more challenging. Lastly, if you're 
purchasing an off-the-shelf controller, 
to ensure the device will work rehably 
in your application, you must know 
how the I/O is implemented. 

Buy it or build it, the reliability of 
the final system is up to \ on. The 
project engineer must do the analysis on 
the I/O systems to determine their suit- 
ability to the application at hand. 

Buying turnkey controllers can re- 
duce hardware design cycles and manu- 
facturing o\'erhead. How ever, selecting 
reliable interfaces suitable to the appli- 
cation still requires you to analyze the 
vendor's implementation of the I/O. 



Figure la—MOSFETs require 
minimal gate drive current, a saving 
grace if you want to drive eight of 
them from a CMOS /C. b—The 
zener is required to prevent the 
maximum V^^ spectotcn §m 
being ( 



Next month, we'U explore the ana- 
log side of coofiroU^ I/O. 



Boh Penin spends his days designing 
general-purpose C -programmable 
embedekd controllers and trouble'- 
shooting customer system-level prob- 
lems far Z-World (www.zworld.com). 
Over the last ten years. Bob has de- 
signed instrumentation for agronomy, 
soil pliysics, and water activity re- 
search. He was also the lead design 
engineer foi' an intrinsically safe line of 
workstations for use in explosive gas 
and particulate environments (class 1, 
divisions I and 2). For more articles by 
Bob, visit his online library at 
www. 



REFERENCE 



[1] R.A. Pease, Troubleshooting 
Analog Circuits, Butterworlh- 
Heinemann, Stondham, MA, 

p. 28, 1991. 



SOURCES 



UDN2985 

Allegro Microsystems, Inc. 
(508) 853-5000 
Fax: (508) 853-7861 
www.allegromicro.com 

TQ-SMD 

Aromat Coip. 
(800) AR0MAT9 
www.aromat.com 

High-speed CMOS Logic 

Fairchild Semiconductor Corp. 
(800) 341-0392 
(207) 775-8100 

Fax: (207) 761-6020 
\v\Mv . f a iich 1 1 dsem i , c om 

NSF-435 ESD gun 

Schaffner EMC, Inc. 
(800) 367-5566 



(973) 379-7778 
Fax: (973) 379-1151 
www.schaffer.com 

FMMT625 

Zetex, Inc. 
(516) 543-7100 
Fax: (516) 864-7630 

74HC259 
Motorola, Inc. 

(561) 739-3880 
Fax: (561) 739-3815 
www.moLcQm 

MOSFETs 

Vishay Intertechnolo^, Inc. 
(619) 535-9080 
Fax: (619) 535-9115 ' 
www. vishay . com 

International Rectifier 

(310) 322-3331 
Fax: (310) 322-3332 
www.irf.com 



Join the discussion on http://bbs. 
circuitcellar.com/cgi-bin/dnewsweb. 
exe and tell us what you think! 



Ciroult Cellar , the Magazine for Computer Applica- 
tions . Reprinted by pern^ission. For subscription 
information, call (860) 876-2199 or 
subseribe@clrcultcellar.com. 



8 QDiHnbwr Wt 



i«Wiu^miiiis«Uw.eofflfeiiUm 



CIRCUIT CELLAR 



THl MAGAZINE FOR COMPUTER APPLICATIONS 



CONSIDERIN 
THEDE 



Bob Perrin 



I/O for Embedded 
Controllers 

Part 2: Analog I/O 




^W/^J^^r ere 
^^^^ outpu 

as; well a 



n Part 1, 1 cov- 
ered digital inputs, 
outputs, and I/O points, 
as well as bridging the gap 
between relativel}' fragile high-speed 
CMOS devices and the real world. In 
this article, I discuss the basics of ana- 
log interfacing. 

Embedded systems are used in so 
many different appHcations, it's impos- 
sible to cover all the analog I/O reciuire- 
ments. Here, I simply offer a few circuits 
and components that have proven ad- 
equate for many applications in the past. 

ADCs 

Acquiring analog signals requires an 
analog to digital converter (ADC). 
There are mom ADCs on the market 
than can be counted in a week. When 
I'm in the market for an ADC, I usually 
look at Analog Devices, Burr-Brown, 
Linear Technologies, TI, and National 
Semiconductor, though not necessanly 
in that order. 

I cuirently have a few favorite de- 
vices. For inexpensive 12-bit conver- 
sion, km partial to the Texas Instiiiments 
TLC2543. This device has an internal 



11 -channel analog multiplexer, comes 
in several 20-pin packages, and costs 
around $4.80. 

For applications requiring a fast 1 2- 
bit converter in a tiny package, I'm 
fond of the Analog Devices AD7887. 
This device is available in an 8-pin 
Micro-SOIC or Narrow-SOIC packs^. 
The Micro-SOIC is particularly impres- 
sive with its 0.025" pitch leads and 
0.196" X 0.244" footprint. 

The AD7887 has one or two analog 
inputs depending on how you configure 
the device. It will sample at 125 kilo- 
samples per second and operate on 
supply rails between 2.7 and 5.25 V. 

The one shortcoming of the AD7887 
is the lack of an internal voltage refer- 
mce. Analog Devices designed this part 
to be low power enough that the AD- 
7887 's pin can be connected di- 
rectly to the output of a reference, 
which means the external reference can 
be used not only as a voltage reference 
but also as a voltage regulator. This 
scheme provides excellent decoupling 
from noise that may be on the raw 
power supply rails. 

The ChipCenter Supercatalog gives a 
quote from Avnet of $4.90 for the AD- 
7887AR, which seems a bit expensive 
for a single-chaimel 12-bit converter. 
But given the other features the AD- 
7887 offers, five bucks is a great deal. 

There is currently a whole slew of 
24-bit delta-sigma converters on the 
market. The AD77.y.v family is possibly 
the most well-known family of 24-bit 
converters. The family has parts that 
are intended to interface directly to 
several common classes of sensors. 

Burr-Brown has the 24-bit ADS- 
1211, which is a full -featured yet inex- 
pensive part. I used this part in a 
project and was quite happy with the 
price/performance ratio. The project 
only required 16 noise-free bits, which 
was easily achieved \Mtli the ADSI21 1. 

Burr-Brown tried to roll so many 



features into the '121 1 that the senal 
communications protocol is a bit over- 
whelming at first glance There are 
several options for configurmg data I/O 
lines and the self-clocked versus exter- 
nally clocked protocol. 

The '1211 also has many options for 
configuring the ccmverter's internal 
sampling, filtering, calibration, and 
gain charactenstics. All of these are 
controlled through the soial pcfft. The 
'1211 has an internal 4-1 analog mux 
and comes in a 24-pin package. The 
mux actually has eight inputs and two 
outputs. Internally the ADS1211 has a 
trae differential input, with the mux, 
this gives the user four channels of true 
differential analog input. 

Although it's a sophisticated device, 
the '121 1 is low in cost. To assist devel- 
opers, Burr-Brown has published sev- 
eral meaty application notes focusing 
on various aspects of the ADS 121 1. 
ThCTe are other members in the 
ADS 121x family. The app notes cover 
all variants equally well. , 

If physical space is a concern, I rec- 
ommend looking at the LTC2400. This 
is a micro-power (200 LiA) delta-sigma 
24-bit ADC in an 8-pm SOIC. The 
LTC2400 doesn't require an ^eternal 
oscillator, although one may be used. 
This ADC has one single-ended analog 
input. A bigger brother, the LTC2408, 
has eight inputs and is in a 28-pin SSOP. 

The LTC2400 claims to be insensi- 
tive to PC 13 layout. The cute little demo 
board available for the LTC2400 is a 
two-layer board with only a single 
ground plane. As a ftirther demonstra- 
tion of the LTC2400's ability to deliver 
high-performance in a relativeh nois\ 
environment, the demo board deri\"es its 
power from the RS-232 connection with 
its host PC. All things considered, the 
LTC240n does an excellent job, in a 
small space, at a low cost. 

SINGLE CONDITIONING 

The world is full of interesting and 
unique analog interfaces. In many em- 
bedded applications, the sensor data is 
environmental or biophysical. Both data 
types share the fact that they are t\ pi- 
cally slow -changing phenomena. I've 
found that most of the time, a simple 
circuit with an op-amp and a few 
passives will serve nicely to bridge the 



Ffom 




Figure ^—This simple single-supply op-amp ciraritwUI 
suffice in most voltage-scalmg applications. 



gap between sensor and ADC. 

Figure 1 shows a versatile circuit 
that maps a imipolar or bipolar input 
voltage to a unipolar output voltage 
suitable for feeding an ADC. The cir- 
cuit only reqfEur!^ ii ^i^e-sided power 
supply. 

The equation that describes the DC 
behavior of ttte ciicatt ^own in. Figme 1 
is: 

^oc/r ~ {^^OFF " ^jy) +Kit 



where V is giv«i by: 



- 1 ^BOTTOM 1 |i> 

'OFF 's ttd raw 

The circuit is fundamentally an in- 
verting amplifier. The gain is given by: 



When designing the circuit, the first 
component to select is R^^ This should 
be selected to be large enough not to 
load the sensor being measured, but 
small enough to allow sufficient gain. 

The next component value to select 
is R^... To do this, first detemiine the 
magmtude of the gain you need: 



This is the right equation, assuming 
you want to map an input \'oltage range 
into a zero to ( output range for an 
ADC. If this isn't the case, just substi- 
tute the magnitude of your ouQnit range 

tor f w 

Chice the gain magnitude and R^^ are 
known, use: 



\G\A-^\ = ^ 



Once and R^ are fixed, you can 
solve ecpiation 1 for V^j,^^ To do this, 
note that the circuit is an in\ crting 
amplifier, which means that V^^ is 
zero when F„ is at a maximum. This 

IN 

leads to: 



= (^^v 



t k?i 



Once you know V^^^ you can select 

values forT?^^^ and R|,o^^o^r ^ usually 
select 10k for/Jj,^^, then solve equation 

can be selected to add a pole at: 

f = ! 

Once you have standard values se- 
lected, you must verify that the standard 
resistor values allow the full input volt- 
age range to map to the proper output 
voltage range. You can fmd a table of 
standard resistor values at www.engineer 
bob.com/stodres.pdf. 

Also, you must be sure that the op- 
amp stays linear o\'er the output \ oltage 
range. Some op-amps have diificulty 
driving near the rails. 

One of the biggest drawbacks of the 
circuit shown in Figure 1 is the fact that 
it's a single-ended circuit. Many sen- 
sors have a differential output. The cir- 
cuit shown in Figure 2 shows a simple 
method to convert and scale a differen- 
tial signal from a sensor to a single-ended 
signal suitable to hook to an ADC. 

Several companies make single-chip 
(monolithic) instrumentation amplifiers 
(in-amps). Burr-Brown, Analog De- 
vices, and Linear Technologies all have 
offerings. Burr-Brown's INAl 18 is a 
good place to start and Analog Devices' 
Anr2.3 IS a low-cost part with great 
features. 

Monolithic in-amps often come in 8- 




Figure 2— For applications that demand the measure- 
ment of a differential signal, the monolithic instnimer^- 
tion ampliier should be considered. 



2 (MSbw tM8 



cfltcurrcBiAR* onune 



wwwjBjieuMMllv^eomMiiic 



pin packages and have a pinout like 
that shown in Figure 2. A single resis- 
tor, Rq, sets the in-amp's gain. Power, 
ground, two inputs, an output, and an 
output reference pin account fer 
remaining six pins. 

In-amps have high-input imped- 
aoaces. Ten-gigaohm typical input im- 
pedances are common, which means 
that even high-resistance bridges can be 
measured with minimal loading. 

The output reference pin allows the 
output voltage to be referenced to some- 
thing other than ground. This ability 
can be useful in mapping a bipolar 
sensor's output into an ADC's input 
range. In Figure 2, the REF pin is con- 
nected to -^REF/2. This arrangranent 
enables the in-amp to map the bridge's 
bipolar output signals into a uniposer 
to REF range. 

Negative inputs are mapped between 
and +REF/2. Positi\e inputs are 
mapped between +REF/2 and REF. 
This assumes that is selected to 
appropriately scale the input signals. 
This arrangranent is useful when the 
ADC's input range is to +REF. 

Some sensors have an output current 
that is proportional to measured phenom- 
ram. Unless the ADC you selected has a 
current input, the current must he con- 
verted to a voltage. A cuixent-to-voltage 
converter is, at its simplest, a resistor. 

If gain is needed, a transimpedance 
amplifier such as the one shovra in 
Figure 3 may be used. The advantage of 
a circuit like Figure 3 is that gain may 
be set with a single resistor. 

Several disadvantages exist as well. 
For example, with high gains, the cir- 
cuit will exhibit a high offset. There are 
se\ eral \ ariations on the basic topology- 
shown in Figure 3 that will reduce off- 
sd; and noise, at hi^tta" gams [1-3]. 

DACs 

Like ADCs, DACs are abundant. 
You can get DACs with current or \'olt- 
age outputs, internal or external refer- 
ences, and parallel or serial digital 
interfaces. 

DACs designed for audio applica- 
tions often do not ha\e the slabilit\' and 
low offset required for control systems. 
These devices are generally available in 
16-bit resoliilii.>ns at rock-bottom prices. 
If your application can tolerate, null, or 



Tsensor 


r 


-^WV 1 


1 — Vtottage 
oytput 



Figure i—tfyou need to do an l-V conversion, a simple 
transmpedance ampSM is a good place to start 

otherwise compensate for the^ offsets, 

an audio DAC may be something to 
consider. The saving grace of audio 
DACs is the fact that they exhibit 
monotonic perfonnance 

Cost, space, and power consumption 
are often the primary considerations for 
selecting a DAC. Analog De\'ices has 
the AD5,lv.r family of DACs. These 
devices come in SOT-23 six-pin pack- 
ages and can be had for a song. These 
parts typically consume less than 150 
HA, and ops^ osiil' » 2.7-5.5-V sup- 
ply range. 

Table 1 compares the three devices 
that I have used in past projects. The 
data in Table 1 was extracted from the 
Analog De\4ee9 wd> site. The ftill 
AD53.V.Y family cuirently has nine parts 
with an additional 15 parts plarmed. 
The full table can be found at 
\\ WW. anakig. com/support./ 
standard_linear/selection_guides/ 
AD53xx.html 

Like any device, the AD5300 parts 
have pros and cons. The biggest con of 
these devices is initial offset. The sec- 
ond biggest con is the "relative accu- 
racy" much like integral nonlinearity 
(INL) for ADCs. In the pros column are 
size, cost, scalability, 10-jis settling 
time, and a l-V/ps slew rate. Overall, 
this family of converters offers a solu- 
tion for many common applications that 
require a digitally controllable voltage. 

Signal conditioning for analog out- 
puts is a similar problem to single con- 
ditioning for analog inputs. The circuit 
shown in I'iLiure ! is excellent for map- 
ping a DAC output voltage to a channel 
output voltage. 

(Xtea an analog output is required to 
dehver more than the few milliamps a 



Device 


Rescdntion 


Cost 


AD5300 


8 bits 


$1.25 


AD5310 


10 bits 


$1.70 


AD5320 


12bits 


$2.50 



Table ^—The ADSSnx famitj/oWersgoodperfcmmKe 
at rock-bottom prices. 



jellybean op-amp can dehver. When this 
happens, you have several options. You 
can use a discrete B.TT or MOSFF.T 
follower in the output stage of your cir- 
cuit. This option works fine if you only 
need to deliver a [x^sitive or a negative 
voltage. But if the output is to be bipolar, 
a simple transistor won't work. 

Class B amplifiers made from discanete 
parts have certain difficulties. The 
plethora of componaits is eq)ensive. The 
biggest problem I've had is crosso\'er 
distortion. The easiest way around all this 
discrete design is to buy an op-amp that 
has the drive capacity you need. 

The Burr-Brown OPA548 is great for 
creating high-current analog outputs. 
The device comes in a 7-pin TO-220 car 
a 7-pin EWPAK. The part can deliver 
continuous 3 A of current and a peak of 
5 A. Burr-Brown's "budgetary 1000- 
piece pricing" is $5.45. One drawback 
of the OPA548 is that it requires a mini- 
mum supply rail of 8 V (or ±4 V in a 
spht-rail system). 

The OPA548 gives the designer the 
ability to hmit the maximum current 
with a single resi^or. The current limit 
can afso be digitally prog7°anmied uang 
an extemal DAC. 

Another important detail to consid^ 
when designing analog output stages is 
power-up state. For example, say you 
have a DAC that deli\ ers 0-5 V feeding 
a circuit (similar to that shown in Fig- 
ure !) that maps the 0-5 'V to ±10 V. 
The power-up state of the DAC may be 
V. That will map to a -HIO-V chaimel 
output. 

If that isn't acceptable, one soluticffl 
is to add a tristate to the output with a 
relay. Figure 4 shows how this scheme 

works. The pull-down resistor holds the 
channel's output at ground when the 
relay is opoi. 

Another solution is to use a flip-flop 
and a small MOSFET connected to the 
system RESET to pull a critical node 
low or high. If this type of scheme is 
used, you must take into account the 
various offsets in the output stage. I 
ha\'e found that getting this scheme to 
initiali/e a channel s output to exactly 
zero can be difficult. If you can live 
with the small errors associated with 
this type of scheme, it is a low-cost 
solution 

The last solution is to select an out- 



ciRcurreiLJuyi* mm 



Qetotar tsas 3 



to micro- f: 
contn3ller|- 



SYSTEM_RESET(L 



tomlCTO-J- 
cofitralte-|- 



Figun 4/— This is a sure my to assure a benign pomr- 

up state 

put amplifier that has the ability to 
Instate or shutdown its output. The 
OPA548 has this capability. 

THATSALL FOLKS 

Analc^ interfaces are found in al- 
most every real-world controller. There 
are many books dedicated to the subject. 
Here I have presented a handful of parts 
and a couple of circuit concepts that 
have proven useful in past projects. My 
hope is that they will serve you well in 
your future designs. 

I would like to leave you with one 
final thought. If you purchase an off- 
the-shelf PLC or controller, you should 
endeavor io understand how the I/O is 
implemented. Purchasing an off-the- 
shelf controller may reduce your hard- 
ware and firmware design cycles 
Certainly you will redu<» your manu- 
facturing oveitead. However, in the 
end, the reliabiUty of &e syst^ is your 
responsibility. 

Obtain as much information about 
how the PLC compan\' implemented the 
analog channels. Lxamme the schemat- 
ics Look carefully at the PCB routing. 
Does the engineering appear sound? 

Ask for data on effective resolution. 
Take the time in your lab to verify the 
performance the manufacturer adver- 
tises. 

TTiePLC vendor's engineers may 
have made tradeoffs to optmiize param- 
eters that may not be the ones your ap- 
plication needs optimized. Tit to 
understand the tradeoffs made by your 
vendor. 

Engineering is a blend of art and 
science. It s full of tradeoffs and details. 
Neva: fear the tradeoffs, and always 
consider the details. 

Over the last leu years. Bob has de- 
signed instrumentation for agronomy. 



DAC V,,, 




Signal 




conditioning 



I L output 




1 



) CLR Q 1 

Q 5-NC 



soil physics, and water activity re- 
search. He has also designed embedded 
controllers for a variety of other apph- 
cations. For more technical resources 
and articles, visit Bob's online library 
at www.engiiieerhoh.coiii .Yoii may 
reach Bob with comments and ques- 
tions at bob^engineerbob. com. 



REFERENCES 



[1] R.F. Graf, The Modem Amplifier 
Circuit Encyclopedia, Tab Books, 
Blue Ridge Summit, PA, 1992, p. 
167. 

[2] Analog Devices, Practical De- 
sign Techniques for Sensor Signal 
Conditioning, 1 999. 

[3] Analog Devices, 1992 Amplifier 
Applicamm Guide, 1992. 



SOURCES 



AD7887, AD623 

Analog Devices 
(617) 329-4700 
Fax: (6171 329-1241 
wwAv.analog.com 

ADS1211, INA118, OPA548 

Burr-Brown Corp. 
(520) 746-1111 
Fax; (520) 889-1510 
www.burr-brown.CQm 

LTC2400 

Linear Technology 
(408) 432-1900 

Fax: (408) 434-0507 
\Nuv\. linear-tech.com 

TLC2543 

Texas Instruments Inc. 

(800) 477-8924, x4500 
(972) 995-2011 
Fax: (972) 995-4360 
www.ti.CQm 



Cirourt Callar. the Magazine for Computer Applica- 
tions . Reprinted by pennission. For subscription 
infermatlon, call (MO) 876-2198 or 
subseribe@eiieutteeilar«em. 



4 Oolabwr 1889 



CIRGUrFCmAlt* OWJNE